🎖️GitЯра🎖️
.github/agents/speckit.git.validate.agent.md ca046eddf2b741fb113fc6bf4503f81e06932121 (ca046edd) Text, 2.11 KB
---
Tc9d1d9description: Validate current branch follows feature branch naming conventions
Tc9d1d9---
<!-- Extension: git -->
<!-- Config: .specify/extensions/git/ -->
Tc9d1d9# Validate Feature Branch
Validate that the current Git branch follows the expected feature branch naming conventions.
Tc9d1d9## Prerequisites
Tff7b72- Check if Git is available by running Ta5d6ff`git rev-parse --is-inside-work-tree 2>/dev/null`
Tff7b72- If Git is not available, output a warning and skip validation:
Ta5d6ff ```
[specify] Warning: Git repository not detected; skipped branch validation
```
Tc9d1d9## Validation Rules
Get the current branch name:
Ta5d6ff```Ta5d6ffbash
git rev-parse --abbrev-ref HEAD
Ta5d6ff```
The branch name must match one of these patterns:
Tff7b721. **Sequential**: Ta5d6ff`^[0-9]{3,}-` (e.g., Ta5d6ff`001-feature-name`, Ta5d6ff`042-fix-bug`, Ta5d6ff`1000-big-feature`)
Tff7b722. **Timestamp**: Ta5d6ff`^[0-9]{8}-[0-9]{6}-` (e.g., Ta5d6ff`20260319-143022-feature-name`)
Tff7b723. **Conventional prefix**: Ta5d6ff`^(feat|fix|chore|docs|build|ci|refactor|test|deps)/` (e.g., Ta5d6ff`feat/add-node-filter`, Ta5d6ff`fix/ble-reconnect`)
Tc9d1d9## Execution
If on a feature branch (matches either pattern):
Tff7b72- Output: Ta5d6ff`✓ On feature branch: <branch-name>`
Tff7b72- For sequential/timestamp branches, check if the corresponding spec directory exists under Ta5d6ff`specs/`:
Tff7b72- For sequential branches, look for Ta5d6ff`specs/<prefix>-*` where prefix matches the numeric portion
Tff7b72- For timestamp branches, look for Ta5d6ff`specs/<prefix>-*` where prefix matches the Ta5d6ff`YYYYMMDD-HHMMSS` portion
Tff7b72- For conventional prefix branches, skip spec directory lookup (not spec-driven)
Tff7b72- If spec directory exists: Ta5d6ff`✓ Spec directory found: <path>`
Tff7b72- If spec directory missing: Ta5d6ff`⚠ No spec directory found for prefix <prefix>`
If NOT on a feature branch:
Tff7b72- Output: Ta5d6ff`✗ Not on a feature branch. Current branch: <branch-name>`
Tff7b72- Output: Ta5d6ff`Feature branches should be named like: 001-feature-name, feat/feature-name, or 20260319-143022-feature-name`
Tc9d1d9## Graceful Degradation
If Git is not installed or the directory is not a Git repository:
Tff7b72- Check the Ta5d6ff`SPECIFY_FEATURE` environment variable as a fallback
Tff7b72- If set, validate that value against the naming patterns
Tff7b72- If not set, skip validation with a warning
Served by rngit 1.5.2 - Generated in 0.12s